<?php
/**
 * 鍓嶇棣栭〉绫�
 * @author 鑲栧皬骞�
 *
 */
class IndexAction extends Action {
	/**
	 * 鍓嶅彴棣栭〉
	 */
    public function index(){
    	//鑾峰彇瀛︽牎绠�粙
    	$school_intr = M('Article')->where('ac_id = 12')->find();
    	//鍔炲鎴愮哗浠嬬粛
    	$school_ach_intr = M('Article')->where('ac_id = 15')->find();
    	//鑾峰彇瀛︽牎棰嗗鏈烘瀯
    	$school_leader = M('Article')->where('ac_id = 7')->order('sort')->limit(0,3)->select();
    	//鑾峰彇澶х編鑻辨墠
    	$school_pic =  M('Article')->where('ac_id = 8')->order('sort')->select();
    	//鑾峰彇鏍″洯鏂伴椈
    	$school_news = M('Article')->where('ac_id = 9')->order('sort')->limit(0,5)->select();
    	//鑾峰彇鍔炲鎴愮哗
    	$school_ach = M('Article')->where('ac_id = 10')->select();
    	//鑾峰彇鑻辨墠瑙嗛
    	$school_vid = M('Article')->where('ac_id = 11')->order('sort')->limit(0,3)->select();
    	$this->assign('school_intr',$school_intr);
    	$this->assign('school_ach_intr',$school_ach_intr);
    	$this->assign('school_leader',$school_leader);
    	$this->assign('school_pic',$school_pic);
    	$this->assign('school_news',$school_news);
    	$this->assign('school_ach',$school_ach);
    	$this->assign('school_vid',$school_vid);
    	
		$this->display();
    }
    /**
     * 棰嗗鏈烘瀯鍒楄〃
     */
    public function index_leader_list(){
    	//鑾峰彇瀛︽牎绠�粙
    	$school_leader = M('Article')->where('ac_id = 7')->order('sort')->select();
    	//鑾峰彇鏍″洯鏂伴椈
    	$school_news = M('Article')->where('ac_id = 9')->order('sort')->select();
    	$this->assign('school_leader',$school_leader);
    	$this->assign('school_news',$school_news);
    	$this->display();
    }
    /**
     * 棰嗗鏈烘瀯璇︽儏
     */
    public function index_leader_detail(){
    	$obj = M('Article')->find($_GET['id']);
    	$this->assign('obj',$obj);
    	$this->display();
    }
    /**
     * 瀛︽牎瑙嗛鍒楄〃
     */
    public function index_vid_list(){
    	$school_vid = M('Article')->where('ac_id = 11')->order('sort')->limit(0,3)->select();
    	$this->assign('school_vid',$school_vid);
    	$this->display();
    }
    /**
     *瀛︽牎鍔炲鎴愮哗
     */
    public function index_ach_list(){
    	//办学成绩介绍
    	$school_ach_intr = M('Article')->where('ac_id = 15')->find();
    	//获取办学成绩
    	$school_ach = M('Article')->where('ac_id = 10')->select();
//     	$this->assign('school_ach_intr',$school_ach_intr);
//     	$this->assign('school_ach',$school_ach);
//     	$this->display();
		$this->ajaxReturn($school_ach);
    }
    /**
     * 澶х編鑻辨墠
     */
    public function index_pic_list(){
    	//鑾峰彇瀛︽牎绠�粙
    	$school_intr = M('Article')->where('ac_id = 12')->find();
    	//鑾峰彇澶х編鑻辨墠
    	$school_pic =  M('Article')->where('ac_id = 8')->order('sort')->select();
    	$this->assign('school_intr',$school_intr);
    	$this->assign('school_pic',$school_pic);
    	$this->display();
    }
    /**
     * 鏍″洯鏂伴椈鍒楄〃
     */
    public function index_news_list(){
    	//鑾峰彇鏍″洯鏂伴椈
    	$school_news = M('Article')->where('ac_id = 9')->order('sort')->select();
    	$this->assign('school_news',$school_news);
    	$this->display();
    }
    /**
     * 鏂伴椈璇︽儏
     * 杩斿洖鏁扮粍
     */
    public function index_news_detail(){
    	$news = M('Article')->find($_GET['id']);
    	$data['visits'] =$news['visits']+1;
    	M('Article')->where('id = '.$_GET['id'])->save($data);
    	$this->assign('news',$news);
    	$this->display();
    }
    public function index_comm(){
    	if($_GET['ac_id']){
    		$where = "ac_id=".$_GET['ac_id']; 
    	}else{
    		$where = "ac_id in (4,5,6)";
    	}
    	$comm_arr = M('Article')->where($where)->select();
    	$this->assign('comm_arr',$comm_arr);
    	$this->display();
    	
    }
    
    /**
     *鑱旂郴鎴戜滑
     */
    public function index_contact(){
    	$this->display();
    }
}